package com.game.view.display
{
    import com.game.view.IAnimation;
    
    import flash.display.MovieClip;
    
    public class McMovieClip extends AnimationClip implements IAnimation
    {
        
        private var _mc:MovieClip;
        
        public function McMovieClip(mc:MovieClip = null)
        {
            super();
            setTexture(mc);
        }
        
        public function setTexture(mc:MovieClip):void
        {
            if(!mc) return;
            _mc = mc;
            init();
        }
        
        private function init():void
        {
            _totalFrames = _mc.totalFrames;
            addChild(_mc);
            _mc.gotoAndStop(_currentFrame);
        }
        
        override protected function render():void
        {
            _mc.gotoAndStop(_currentFrame);
//            McUtil.stopAllChildren(_mc);
        }
        
        override public function Destroy():void
        {
            removeChild(_mc);
            _mc = null;
        }
    }
}
